<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <!-- 引入JQuery -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.min.js"></script>
    <!-- 引入EasyUI -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
    <!-- 引入EasyUI的中文国际化js，让EasyUI支持中文 -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
    <!--
    <script  type="text/javascript" src="scripts/index.js"></script>
  -->
    <!-- 引入EasyUI的样式文件-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css" type="text/css"/>
    <!-- 引入EasyUI的图标样式文件-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/easyui/themes/icon.css" type="text/css"/>
    <style type="text/css">
        #logo {
            width: 180px;
            line-height: 50px;
            text-align: center;
            height: 50px;
            font-weight: bold;
            float: left;
            font-size: 20px;
        }

        #logout {
            float: right;
            padding: 30px 15px 0 0;
        }

        a {
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body class="easyui-layout">
<div data-options="region:'north',title:'North Title',split:true,noheader:true" style="height:60px;">
    <div id="logo">
        仓库后台管理
    </div>
    <div id="logout">
        您好${username}<a href="${pageContext.request.contextPath}/logout">退出</a>
    </div>
</div>
<div data-options="region:'south',title:'South Title',split:true,noheader:true"
     style="height:100px;;height:35px;line-height:30px;"></div>
<div data-options="region:'west',title:'导航',split:true" style="width:250px;padding:10px;">
    <div id="nav">
    </div>
</div>
<div data-options="region:'center'" style="padding:5px;background:#eee;">
    <div id="tt" class="easyui-tabs" fit=true style="width:500px;height:250px;">
    </div>
</div>
</body>
<script type="text/javascript">
    /*
     $(function(){
     $('a[title]').click(function(){
     var src = $(this).attr('title');
     var title = $(this).html();
     if($('#tt').tabs('exists' ,title)){
     $('#tt').tabs('select',title);
     } else {
     $('#tt').tabs('add',{
     title:title,
     content:'<iframe frameborder=0 style=width:100%;height:100% src='+ '${pageContext.request.contextPath}/test' +' ></iframe>',
     closable:true
     });
     }
     });
     });*/

    $(function () {
        $('#nav').tree({
            url: "function/buildMenuAccordion",
            lines: true,
            onClick: function (node) {
                if (node.nodeAttribute && node.nodeAttribute.url) {
                    alert( node.nodeAttribute.url);
                    //$('#show_win').panel('refresh',".");
                    // $('body').layout('panel', 'center').panel('setTitle', node.text);
                    if ($('#tt').tabs('exists', node.text)) {
                        $('#tt').tabs('select', node.text);
                    } else {
                        $('#tt').tabs('add', {
                            title: node.text,
                            content: '<iframe frameborder=0 style=width:100%;height:100% src='+ '${pageContext.request.contextPath}'+ node.nodeAttribute.url+' ></iframe>',
                            closable: true
                        });
                    }
                }
            }
        });
    });
    /*
     $('#show_win').panel({
     fit:true,
     border:false,
     noheader:false
     });

     function addTab(title,url,id) {
     alert(url);
     if (!$("#tabs").tabs('exists', title)) {
     $("#tabs").tabs("add", {
     title: title,
     closable: true,
     width: $('#tabs').width(),
     height: $('#tabs').height(),
     });
     } else {
     $('#tabs').tabs('select', title);
     }

     var currentTabPanel = $("#tabs").tabs('getSelected');
     var dynamicTable = $('<table id="tb"+id></table>');
     //这里一定要先添加到currentTabPanel中，因为dynamicTable.datagrid()函数需要调用到parent函数
     currentTabPanel.html(dynamicTable);
     dynamicTable.datagrid({
     url: ""+url,
     columns: [[
     {field: 'id', title: '编号', width: 40},
     {field: 'name', title: '商品名称', width: 100},
     {field: 'type', title: '商品类型', width: 100},
     {field: 'price', title: '商品价格', width: 100},
     {field: 'quantity', title: '商品库存量', width: 100}
     ]],
     pagination:true,
     pageList: [5,10,15,20,25,30],
     title:title
     });
     }

     }); */
</script>
</html>


